package com.rocket.transaction_message;

import com.rocket.transaction_message.dto.OrderPaidEvent;
import com.rocket.transaction_message.service.IRocketMQService;
import org.apache.rocketmq.client.impl.MQAdminImpl;
import org.apache.rocketmq.client.producer.SendResult;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.math.BigDecimal;

/**
 * @author CKC
 * @date 2022/12/27 10:00
 */
@SpringBootApplication(scanBasePackages = {"com.rocket.transaction_message"})
public class RocketMQProducerApplication {
    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(RocketMQProducerApplication.class);
        IRocketMQService bean = context.getBean(IRocketMQService.class);
        SendResult sendResult = bean.sendMessageInTransaction("Hello:1234", new OrderPaidEvent("1234567890", new BigDecimal("10"), "12345").toString(), null);

        System.out.println(sendResult);
    }
}
